﻿'条件データ

Public Class clsDbCondData

    Public Function GetTapeData(ByVal szLotNo As String) As DataTable
        Dim szSql As String = ""
        szSql &= "SELECT CUSTOMER_NM, KIND_NM, PB_LAYOUT, SHAPE1||SHAPE2||SHAPE3 AS SHAPE, "
        szSql &= "  OF_ANGLE, TAPE, WAFER_D, WAFER_T "
        szSql &= "  "
        For i = 1 To 15
            szSql &= ",FLOW" & i.ToString & " "
        Next
        szSql &= "FROM ( "
        szSql &= "  SELECT KLOTNO AS LOT_NO,"
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='顧客名' THEN KOMOKUDATA ELSE '' END),'') AS CUSTOMER_NM, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='品名' THEN KOMOKUDATA ELSE '' END),'') AS KIND_NM, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='PB-LAYOUT図1' AND KOTEI='組立' THEN KOMOKUDATA ELSE '' END),'') AS PB_LAYOUT, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形1' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE1,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形2' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE2,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形3' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE3,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='OF角度' THEN KOMOKUDATA ELSE '' END),'') AS OF_ANGLE, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='テープ' THEN KOMOKUDATA ELSE '' END),'') AS TAPE, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='ウエハ径' THEN KOMOKUDATA ELSE '' END),'') AS WAFER_D, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='ウエハ厚' THEN KOMOKUDATA ELSE '' END),'') AS WAFER_T, "
        For i = 1 To 14
            szSql &= String.Format("    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='ﾀﾞｲｼﾝｸﾞ作業ﾌﾛｰ{0}' THEN KOMOKUDATA ELSE '' END),'') AS FLOW{0}, ", i)
        Next
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='ﾀﾞｲｼﾝｸﾞ作業ﾌﾛｰ15' THEN KOMOKUDATA ELSE '' END),'') AS FLOW15 "
        szSql &= "  FROM PER.L_JYOKENDATA "
        szSql &= "  WHERE KLOTNO = '" & szLotNo & "' "
        szSql &= "  GROUP BY KLOTNO "
        szSql &= ") AS T"

        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1, szLotNo)
        If IsNothing(dt) Then
            GetTapeData = New DataTable
        Else
            GetTapeData = dt
        End If
    End Function

    Public Function GetDicingData(ByVal szLotNo As String) As DataTable
        Dim i As Integer
        Dim szSql As String = ""
        szSql &= "SELECT CUSTOMER_NM, KIND_NM, PB_LAYOUT, SHAPE1||SHAPE2||SHAPE3 AS SHAPE, "
        szSql &= "  SIZE_X||' X '||SIZE_Y AS DIE_SIZE, BLADE, WAFER_D, WAFER_T ,"
        szSql &= "  RECIP "
        szSql &= "  "
        For i = 1 To 15
            szSql &= ",FLOW" & i.ToString & " "
        Next
        szSql &= "FROM ( "
        szSql &= "  SELECT KLOTNO AS LOT_NO,"
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='顧客名' THEN KOMOKUDATA ELSE '' END),'') AS CUSTOMER_NM, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='品名' THEN KOMOKUDATA ELSE '' END),'') AS KIND_NM, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='PB-LAYOUT図1' AND KOTEI='組立' THEN KOMOKUDATA ELSE '' END),'') AS PB_LAYOUT, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形1' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE1,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形2' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE2,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形3' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE3,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='チップサイズx' THEN KOMOKUDATA ELSE '' END),'') AS SIZE_X, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='チップサイズy' THEN KOMOKUDATA ELSE '' END),'') AS SIZE_Y, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='ブレード' THEN KOMOKUDATA ELSE '' END),'') AS BLADE, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='ウエハ径' THEN KOMOKUDATA ELSE '' END),'') AS WAFER_D, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='ウエハ厚' THEN KOMOKUDATA ELSE '' END),'') AS WAFER_T, "
        For i = 1 To 14
            szSql &= String.Format("    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='ﾀﾞｲｼﾝｸﾞ作業ﾌﾛｰ{0}' THEN KOMOKUDATA ELSE '' END),'') AS FLOW{0}, ", i)
        Next
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='ﾀﾞｲｼﾝｸﾞ作業ﾌﾛｰ15' THEN KOMOKUDATA ELSE '' END),'') AS FLOW15 ,"
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='装置レシピ名提示' THEN KOMOKUDATA ELSE '' END),'') AS RECIP "
        szSql &= "  FROM PER.L_JYOKENDATA "
        szSql &= "  WHERE KLOTNO = '" & szLotNo & "' "
        szSql &= "  GROUP BY KLOTNO "
        szSql &= ") AS T"

        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1, szLotNo)
        If IsNothing(dt) Then
            GetDicingData = New DataTable
        Else
            GetDicingData = dt
        End If
    End Function

    Public Function GetDicChkData(ByVal szLotNo As String) As DataTable
        Dim szSql As String = ""
        szSql &= "SELECT CUSTOMER_NM, KIND_NM, PB_LAYOUT, SHAPE1||SHAPE2||SHAPE3 AS SHAPE, "
        szSql &= "  OF_ANGLE, CHECK_SPEC, CHIP_NAME "
        szSql &= "  "
        For i = 1 To 15
            szSql &= ",FLOW" & i.ToString & " "
        Next
        szSql &= "FROM ( "
        szSql &= "  SELECT KLOTNO AS LOT_NO,"
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='顧客名' THEN KOMOKUDATA ELSE '' END),'') AS CUSTOMER_NM, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='品名' THEN KOMOKUDATA ELSE '' END),'') AS KIND_NM, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='PB-LAYOUT図1' AND KOTEI='組立' THEN KOMOKUDATA ELSE '' END),'') AS PB_LAYOUT, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形1' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE1,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形2' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE2,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形3' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE3,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='OF角度' THEN KOMOKUDATA ELSE '' END),'') AS OF_ANGLE, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='検査仕様' THEN KOMOKUDATA ELSE '' END),'') AS CHECK_SPEC, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='ﾁｯﾌﾟ型名' THEN KOMOKUDATA ELSE '' END),'') AS CHIP_NAME, "
        For i = 1 To 14
            szSql &= String.Format("    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='ﾀﾞｲｼﾝｸﾞ作業ﾌﾛｰ{0}' THEN KOMOKUDATA ELSE '' END),'') AS FLOW{0}, ", i)
        Next
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='ﾀﾞｲｼﾝｸﾞ作業ﾌﾛｰ15' THEN KOMOKUDATA ELSE '' END),'') AS FLOW15 "
        szSql &= "  FROM PER.L_JYOKENDATA "
        szSql &= "  WHERE KLOTNO = '" & szLotNo & "' "
        szSql &= "  GROUP BY KLOTNO "
        szSql &= ") AS T"

        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1, szLotNo)
        If IsNothing(dt) Then
            GetDicChkData = New DataTable
        Else
            GetDicChkData = dt
        End If
    End Function

    Public Function GetDbData(ByVal szLotNo As String) As DataTable
        Dim szSql As String = ""
        ' 蘇州対応 2017/04/18 T.Yutaro Upd Start
        szSql &= "SELECT CUSTOMER_NM, KIND_NM, PB_LAYOUT, SHAPE1||SHAPE2||SHAPE3 AS SHAPE, "
        'szSql &= "  GUM_COL, COLLET, POCKET, NIDDLE, KOMA, STAGE, NOZZEL,  PASTE, "
        'szSql &= "  SUB_CHIP1||' '||SUB_CHIP2 AS SUB_CHIP, FRAME||'/'||PCB_NAME AS FRRAME_NM, "
        'szSql &= "  CHIP_ARR, SIZE_X||' X '||SIZE_Y AS DIE_SIZE, FRAME_MK, CURE, MEMO "
        szSql &= "  GUM_COL, PASTE, FRAME||'/'||PCB_NAME AS FRRAME_NM, CHIP_ARR, FRAME_MK, MEMO, "
        szSql &= "  EQUIP_RECIPE, WAFER_SUPPLY, GRADE "
        szSql &= "FROM ( "
        szSql &= "  SELECT KLOTNO AS LOT_NO,"
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='顧客名' THEN KOMOKUDATA ELSE '' END),'') AS CUSTOMER_NM, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='品名' THEN KOMOKUDATA ELSE '' END),'') AS KIND_NM, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='PB-LAYOUT図1' AND KOTEI='組立' THEN KOMOKUDATA ELSE '' END),'') AS PB_LAYOUT, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形1' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE1,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形2' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE2,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形3' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE3,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='ゴムコレット' THEN KOMOKUDATA ELSE '' END),'') AS GUM_COL, "
        'szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='D/Bコレ' THEN KOMOKUDATA ELSE '' END),'') AS COLLET, "
        'szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='D/Bポケ' THEN KOMOKUDATA ELSE '' END),'') AS POCKET, "
        'szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='押え' THEN KOMOKUDATA ELSE '' END),'') AS NIDDLE, "
        'szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='コマ' THEN KOMOKUDATA ELSE '' END),'') AS KOMA, "
        'szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='ステージ' THEN KOMOKUDATA ELSE '' END),'') AS STAGE, " 'Null
        'szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='D/Bノズル' THEN KOMOKUDATA ELSE '' END),'') AS NOZZEL, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='D/Bﾍﾟｰｽﾄ' THEN KOMOKUDATA ELSE '' END),'') AS PASTE, "
        'szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='サブD/B1品名' THEN KOMOKUDATA ELSE '' END),'') AS SUB_CHIP1, "
        'szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='サブD/B2品名' THEN KOMOKUDATA ELSE '' END),'') AS SUB_CHIP2, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='ﾌﾚｰﾑ/基板型名1' THEN KOMOKUDATA ELSE '' END),'') AS FRAME, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='ﾌﾚｰﾑ/基板型名2' THEN KOMOKUDATA ELSE '' END),'') AS PCB_NAME, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='チップアレンジ' AND KOTEI='組立' THEN KOMOKUDATA ELSE '' END),'') AS CHIP_ARR, "
        'szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='チップサイズx' THEN KOMOKUDATA ELSE '' END),'') AS SIZE_X, "
        'szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='チップサイズy' THEN KOMOKUDATA ELSE '' END),'') AS SIZE_Y, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='ﾌﾚｰﾑ刻印' THEN KOMOKUDATA ELSE '' END),'') AS FRAME_MK, "
        'szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='キュア方法' THEN KOMOKUDATA ELSE '' END),'') AS CURE, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='備考（B）' AND KOTEI='組立' THEN KOMOKUDATA ELSE '' END),'') AS MEMO, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='装置レシピ名' AND KOTEI='組立' THEN KOMOKUDATA ELSE '' END),'') AS EQUIP_RECIPE, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='ウェハ支給型名' AND KOTEI='組立' THEN KOMOKUDATA ELSE '' END),'') AS WAFER_SUPPLY, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='grade' AND KOTEI='組立' THEN KOMOKUDATA ELSE '' END),'') AS GRADE "
        ' 蘇州対応 2017/04/18 T.Yutaro Upd End
        szSql &= "  FROM PER.L_JYOKENDATA "
        szSql &= "  WHERE KLOTNO = '" & szLotNo & "' "
        szSql &= "  GROUP BY KLOTNO "
        szSql &= ") AS T"

        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1, szLotNo)
        If IsNothing(dt) Then
            GetDbData = New DataTable
        Else
            GetDbData = dt
        End If
    End Function

    Public Function GetPlasmaWbData(ByVal szLotNo As String) As DataTable
        Dim szSql As String = ""
        szSql &= "SELECT CUSTOMER_NM, KIND_NM, PB_LAYOUT, SHAPE1||SHAPE2||SHAPE3 AS SHAPE, "
        szSql &= "  COND, THICK, MEMO "
        szSql &= "FROM ( "
        szSql &= "  SELECT KLOTNO AS LOT_NO,"
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='顧客名' THEN KOMOKUDATA ELSE '' END),'') AS CUSTOMER_NM, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='品名' THEN KOMOKUDATA ELSE '' END),'') AS KIND_NM, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='PB-LAYOUT図1' AND KOTEI='組立' THEN KOMOKUDATA ELSE '' END),'') AS PB_LAYOUT, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形1' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE1,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形2' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE2,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形3' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE3,  "
        'szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='組立作業ﾌﾛｰ3' THEN KOMOKUDATA ELSE '' END),'') AS COND, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='プラズマ条件' THEN KOMOKUDATA ELSE '' END),'') AS COND, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='フレーム板厚' THEN KOMOKUDATA ELSE '' END),'') AS THICK, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='備考（B）' AND KOTEI='組立' THEN KOMOKUDATA ELSE '' END),'') AS MEMO "
        szSql &= "  FROM PER.L_JYOKENDATA "
        szSql &= "  WHERE KLOTNO = '" & szLotNo & "' "
        szSql &= "  GROUP BY KLOTNO "
        szSql &= ") AS T"

        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1, szLotNo)
        If IsNothing(dt) Then
            GetPlasmaWbData = New DataTable
        Else
            GetPlasmaWbData = dt
        End If
    End Function

    Public Function GetWbData(ByVal szLotNo As String) As DataTable
        Dim szSql As String = ""
        szSql &= "SELECT CUSTOMER_NM, KIND_NM, PB_LAYOUT, SHAPE1||SHAPE2||SHAPE3 AS SHAPE, "
        'szSql &= "    FRAME_ID, PIN, KOMA, WIRE1||WIRE2 AS WIRE, TEMP, CAPI1||CAPI2 AS CAPILLARY, THICK, MEMO "
        szSql &= "    FRAME_ID, PIN, KOMA, WIRE, TEMP, CAPILLARY, THICK, MEMO, DMY1, CASEINPUT "
        szSql &= "FROM ( "
        szSql &= "  SELECT KLOTNO AS LOT_NO,"
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='顧客名' THEN KOMOKUDATA ELSE '' END),'') AS CUSTOMER_NM, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='品名' THEN KOMOKUDATA ELSE '' END),'') AS KIND_NM, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='PB-LAYOUT図1' AND KOTEI='組立' THEN KOMOKUDATA ELSE '' END),'') AS PB_LAYOUT, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形1' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE1,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形2' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE2,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形3' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE3,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='ﾌﾚｰﾑ/基板型名2' THEN KOMOKUDATA ELSE '' END),'') AS FRAME_ID, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='押え' THEN KOMOKUDATA ELSE '' END),'') AS PIN, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='コマ' THEN KOMOKUDATA ELSE '' END),'') AS KOMA, "
        'szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='WIRE1' THEN KOMOKUDATA ELSE '' END),'') AS WIRE1, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='Au線' THEN KOMOKUDATA ELSE '' END),'') AS WIRE, "
        'szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='WIRE2' THEN KOMOKUDATA ELSE '' END),'') AS WIRE2, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='WB温度' THEN KOMOKUDATA ELSE '' END),'') AS TEMP, "
        'szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='キャピラリ1' THEN KOMOKUDATA ELSE '' END),'') AS CAPI1, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='キャピラリ' THEN KOMOKUDATA ELSE '' END),'') AS CAPILLARY, "
        'szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='キャピラリ2' THEN KOMOKUDATA ELSE '' END),'') AS CAPI2, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='フレーム板厚' THEN KOMOKUDATA ELSE '' END),'') AS THICK, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='備考（B）' AND KOTEI='組立' THEN KOMOKUDATA ELSE '' END),'') AS MEMO, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='装置レシビ名提示' AND KOTEI='組立' THEN KOMOKUDATA ELSE '' END),'') AS DMY1, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='ケース、ラックナンバー入力' AND KOTEI='組立' THEN KOMOKUDATA ELSE '' END),'') AS CASEINPUT "

        szSql &= "  FROM PER.L_JYOKENDATA "
        szSql &= "  WHERE KLOTNO = '" & szLotNo & "' "
        szSql &= "  GROUP BY KLOTNO "
        szSql &= ") AS T"

        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1, szLotNo)
        If IsNothing(dt) Then
            GetWbData = New DataTable
        Else
            GetWbData = dt
        End If
    End Function

    Public Function GetWbLotData(ByVal szLotNo As String) As DataTable
        Dim szSql As String = ""
        Dim szDUMMY As String = ""

        szSql &= "SELECT LOT_NO , WAFER_LOTNO , STATUS , EQUIPNO , KOUTEI_CODE , INVNUM , COMPNUM , BADNUM , FRAMENUM , BADMARKNUM , Q_FLG , TEST_FLG , CHECK_FLG , HOLDSTATUS, BADMARK_FRAMENUM "
        szSql &= "  , DISPOSAL_FRAME_NUM , FRAME_ID_USE " 'ADD 苗 2018/1/24　'ADD 苗 2018/1/26 フレームID対応
        '>>20180131 佐川 キャリア交換対応
        szSql &= "  , CONTAINER1 , CONTAINER2, CONTAINER3, CONTAINER4, CONTAINER5 "
        '<<20180131 佐川 キャリア交換対応
        '>>2018/2/13 大賀 サンプル数量対応
        szSql &= "  , PLT_EQUIPNO "
        '>>2018/2/13 大賀 サンプル数量対応
        '>>2018/2/16 大賀 No74 ICタグ編集項目追加対応
        szSql &= "  , EMPTY_CHIP_NUM "
        '<<2018/2/16 大賀 No74 ICタグ編集項目追加対応
        '>>20180302 大賀 GroupKey入力時ウェハ枚数入力
        szSql &= "  , WAFER_NUM "
        '<<20180302 大賀 GroupKey入力時ウェハ枚数入力
        szSql &= "  FROM PER.L_TAG_LOTDATA "
        szSql &= " WHERE LOT_NO = '" & szLotNo & "' "

        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1)
        If IsNothing(dt) Then
            GetWbLotData = New DataTable
        Else
            GetWbLotData = dt
        End If
    End Function

    Public Function GetDiffLotData(ByVal szLotNo As String) As String
        Dim szSql As String = ""
        Dim szDUMMY As String = ""
        GetDiffLotData = ""

        szSql &= "SELECT MIN(LOT_NO) "
        szSql &= "  FROM PER.L_TAG_LOTDATA "
        szSql &= " WHERE WAFER_LOTNO = '" & szLotNo & "' "

        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1)
        If Not IsNothing(dt) AndAlso dt.Rows.Count > 0 AndAlso Not IsDBNull(dt.Rows(0)(0)) Then
            GetDiffLotData = dt.Rows(0)(0)
        End If
    End Function

    ''' <summary>
    ''' GroupIDでLOTを取得
    ''' </summary>
    ''' <param name="szGroupID"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function GetGroupLot(ByVal szGroupID As String) As String()
        Dim szSql As String = ""
        Dim szDUMMY As String = ""

        szSql &= "SELECT LOT_NO "
        szSql &= "  FROM PER.L_TAG_LOTDATA "
        '>>20180111 佐川
        szSql &= " WHERE wafer_lotno = '" & szGroupID & "' order by lot_no"
        '<<20180111 佐川
        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1)
        If Not IsNothing(dt) AndAlso dt.Rows.Count > 0 Then
            Dim lstLot As New List(Of String)
            For Each row As DataRow In dt.Rows
                lstLot.Add(row(0))
            Next
            Return lstLot.ToArray
        Else
            Return {szGroupID}
        End If
    End Function

    Public Function IsWbPlasmaNeeded(ByVal szLotNo As String) As Boolean
        Dim szSql As String = ""
        szSql &= "SELECT KOMOKUDATA "
        szSql &= "FROM PER.L_JYOKENDATA "
        szSql &= "WHERE KLOTNO = '" & szLotNo & "' "
        szSql &= "AND KOTEI='組立' "
        szSql &= "AND KOMOKUDATA LIKE '%P/C%'"

        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1, szLotNo)
        If IsNothing(dt) Then
            Return False
        ElseIf dt.Rows.Count > 0 Then
            Return True
        Else
            Return False
        End If
    End Function

    Public Function GetPlasmaMdData(ByVal szLotNo As String) As DataTable
        Dim szSql As String = ""
        szSql &= "SELECT CUSTOMER_NM, KIND_NM, PB_LAYOUT, SHAPE1||SHAPE2||SHAPE3 AS SHAPE, "
        szSql &= "  COND, THICK, MEMO1, MEMO2 "
        szSql &= "FROM ( "
        szSql &= "  SELECT KLOTNO AS LOT_NO,"
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='顧客名' THEN KOMOKUDATA ELSE '' END),'') AS CUSTOMER_NM, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='品名' THEN KOMOKUDATA ELSE '' END),'') AS KIND_NM, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='PB-LAYOUT図1' AND KOTEI='組立' THEN KOMOKUDATA ELSE '' END),'') AS PB_LAYOUT, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形1' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE1,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形2' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE2,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形3' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE3,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='封止・先切り作業ﾌﾛｰ2' THEN KOMOKUDATA ELSE '' END),'') AS COND, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='フレーム板厚' THEN KOMOKUDATA ELSE '' END),'') AS THICK, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='備考（C）上段' THEN KOMOKUDATA ELSE '' END),'') AS MEMO1, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='備考（C）下段' THEN KOMOKUDATA ELSE '' END),'') AS MEMO2 "
        szSql &= "  FROM PER.L_JYOKENDATA "
        szSql &= "  WHERE KLOTNO = '" & szLotNo & "' "
        szSql &= "  GROUP BY KLOTNO "
        szSql &= ") AS T"

        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1, szLotNo)
        If IsNothing(dt) Then
            GetPlasmaMdData = New DataTable
        Else
            GetPlasmaMdData = dt
        End If
    End Function

    Public Function GetMoldData(ByVal szLotNo As String) As DataTable
        Dim szSql As String = ""
        szSql &= "SELECT CUSTOMER_NM, KIND_NM, PB_LAYOUT, SHAPE1||SHAPE2||SHAPE3 AS SHAPE, "
        szSql &= "    LIMIT_T, MOLD1||MOLD2||MOLD3||MOLD_U AS TOOL, FRAME, THICK, RESIN, MEMO1, MEMO2 "
        szSql &= "FROM ( "
        szSql &= "  SELECT KLOTNO AS LOT_NO,"
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='顧客名' THEN KOMOKUDATA ELSE '' END),'') AS CUSTOMER_NM, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='品名' THEN KOMOKUDATA ELSE '' END),'') AS KIND_NM, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='PB-LAYOUT図1' AND KOTEI='組立' THEN KOMOKUDATA ELSE '' END),'') AS PB_LAYOUT, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形1' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE1,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形2' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE2,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形3' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE3,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='リミットタイム' AND KOTEI='封止・先切り' THEN KOMOKUDATA ELSE '' END),'') AS LIMIT_T, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='適用金型上段1' THEN KOMOKUDATA ELSE '' END),'') AS MOLD1,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='適用金型上段2' THEN KOMOKUDATA ELSE '' END),'') AS MOLD2,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='適用金型上段3' THEN KOMOKUDATA ELSE '' END),'') AS MOLD3,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='適用金型下段' THEN KOMOKUDATA ELSE '' END),'') AS MOLD_U,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='ﾌﾚｰﾑ/基板型名1' THEN KOMOKUDATA ELSE '' END),'') AS FRAME, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='フレーム板厚' THEN KOMOKUDATA ELSE '' END),'') AS THICK, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='レジン' THEN KOMOKUDATA ELSE '' END),'') AS RESIN, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='備考（C）上段' THEN KOMOKUDATA ELSE '' END),'') AS MEMO1, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='備考（C）下段' THEN KOMOKUDATA ELSE '' END),'') AS MEMO2 "
        szSql &= "  FROM PER.L_JYOKENDATA "
        szSql &= "  WHERE KLOTNO = '" & szLotNo & "' "
        szSql &= "  GROUP BY KLOTNO "
        szSql &= ") AS T"

        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1, szLotNo)
        If IsNothing(dt) Then
            GetMoldData = New DataTable
        Else
            GetMoldData = dt
        End If
    End Function

    Public Function GetFTXData(ByVal szLotNo As String) As DataTable
        Dim szSql As String = ""
        szSql &= "SELECT CUSTOMER_NM, KIND_NM, PB_LAYOUT, SHAPE1||SHAPE2||SHAPE3 AS SHAPE, "
        szSql &= "    X_CHECK, MEMO1, MEMO2 "
        szSql &= "FROM ( "
        szSql &= "  SELECT KLOTNO AS LOT_NO,"
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='顧客名' THEN KOMOKUDATA ELSE '' END),'') AS CUSTOMER_NM, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='品名' THEN KOMOKUDATA ELSE '' END),'') AS KIND_NM, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='PB-LAYOUT図1' AND KOTEI='組立' THEN KOMOKUDATA ELSE '' END),'') AS PB_LAYOUT, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形1' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE1,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形2' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE2,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形3' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE3,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='X線検査仕様' THEN KOMOKUDATA ELSE '' END),'') AS X_CHECK, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='備考（C）上段' THEN KOMOKUDATA ELSE '' END),'') AS MEMO1, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='備考（C）下段' THEN KOMOKUDATA ELSE '' END),'') AS MEMO2 "
        szSql &= "  FROM PER.L_JYOKENDATA "
        szSql &= "  WHERE KLOTNO = '" & szLotNo & "' "
        szSql &= "  GROUP BY KLOTNO "
        szSql &= ") AS T"

        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1, szLotNo)
        If IsNothing(dt) Then
            GetFTXData = New DataTable
        Else
            GetFTXData = dt
        End If
    End Function

    Public Function GetBMData(ByVal szLotNo As String) As DataTable
        Dim szSql As String = ""
        szSql &= "SELECT CUSTOMER_NM, KIND_NM, PB_LAYOUT, SHAPE1||SHAPE2||SHAPE3 AS SHAPE, "
        szSql &= "  LIMIT_T, BALL_1, BALL_2 "
        szSql &= "FROM ( "
        szSql &= "  SELECT KLOTNO AS LOT_NO,"
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='顧客名' THEN KOMOKUDATA ELSE '' END),'') AS CUSTOMER_NM, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='品名' THEN KOMOKUDATA ELSE '' END),'') AS KIND_NM, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='PB-LAYOUT図1' AND KOTEI='組立' THEN KOMOKUDATA ELSE '' END),'') AS PB_LAYOUT, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形1' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE1,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形2' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE2,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形3' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE3,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='MOLDﾘﾌﾛｰﾘﾐｯﾄﾀｲﾑ' THEN KOMOKUDATA ELSE '' END),'') AS LIMIT_T, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='メッキ・ボール仕様上段' THEN KOMOKUDATA ELSE '' END),'') AS BALL_1, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='メッキ・ボール仕様下段' THEN KOMOKUDATA ELSE '' END),'') AS BALL_2 "
        szSql &= "  FROM PER.L_JYOKENDATA "
        szSql &= "  WHERE KLOTNO = '" & szLotNo & "' "
        szSql &= "  GROUP BY KLOTNO "
        szSql &= ") AS T"

        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1, szLotNo)
        If IsNothing(dt) Then
            GetBMData = New DataTable
        Else
            GetBMData = dt
        End If
    End Function

    Public Function GetInspData(ByVal szLotNo As String) As DataTable
        Dim szSql As String = ""
        szSql &= "SELECT CUSTOMER_NM, KIND_NM, PB_LAYOUT, SHAPE1||SHAPE2||SHAPE3 AS SHAPE, "
        ' 蘇州対応 2017/04/14 T.Yutaro Upd Start
        'szSql &= "  TRAY, STOPPER, BOX, FULL_SHIP, STORAGE, SPECIAL, LABEL,  SHIP_NM, SOURCE "
        szSql &= "  COND, CHIP_TYPE, MEMO "
        ' 蘇州対応 2017/04/14 T.Yutaro Upd End
        szSql &= "FROM ( "
        szSql &= "  SELECT KLOTNO AS LOT_NO,"
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='顧客名' THEN KOMOKUDATA ELSE '' END),'') AS CUSTOMER_NM, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='品名' THEN KOMOKUDATA ELSE '' END),'') AS KIND_NM, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='PB-LAYOUT図1' AND KOTEI='組立' THEN KOMOKUDATA ELSE '' END),'') AS PB_LAYOUT, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形1' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE1,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形2' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE2,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形3' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE3,  "
        ' 蘇州対応 2017/04/14 T.Yutaro Upd Start
        'szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='トレイ･マガジン' THEN KOMOKUDATA ELSE '' END),'') AS TRAY, "
        'szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='ストッパ' THEN KOMOKUDATA ELSE '' END),'') AS STOPPER, "
        'szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='内装箱' THEN KOMOKUDATA ELSE '' END),'') AS BOX, "
        'szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='満数出荷' THEN KOMOKUDATA ELSE '' END),'') AS FULL_SHIP, "
        'szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='収納方法' THEN KOMOKUDATA ELSE '' END),'') AS STORAGE, "
        'szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='特仕内容' THEN KOMOKUDATA ELSE '' END),'') AS SPECIAL, "
        'szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='出荷ラベル' THEN KOMOKUDATA ELSE '' END),'') AS LABEL, "
        'szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='出荷型名' THEN KOMOKUDATA ELSE '' END),'') AS SHIP_NM, "
        'szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='移管元' THEN KOMOKUDATA ELSE '' END),'') AS SOURCE "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='検査仕様' THEN KOMOKUDATA ELSE '' END),'') AS COND, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='ﾁｯﾌﾟ型名' THEN KOMOKUDATA ELSE '' END),'') AS CHIP_TYPE, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='備考（B）' AND KOTEI='組立' THEN KOMOKUDATA ELSE '' END),'') AS MEMO "
        ' 蘇州対応 2017/04/14 T.Yutaro Upd End
        szSql &= "  FROM PER.L_JYOKENDATA "
        szSql &= "  WHERE KLOTNO = '" & szLotNo & "' "
        szSql &= "  GROUP BY KLOTNO "
        szSql &= ") AS T"

        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1, szLotNo)
        If IsNothing(dt) Then
            GetInspData = New DataTable
        Else
            GetInspData = dt
        End If
    End Function

    Public Function GetBiData(ByVal szLotNo As String) As DataTable
        Dim i As Integer
        Dim szSql As String = ""
        szSql &= "SELECT CUSTOMER_NM, KIND_NM, PB_LAYOUT, SHAPE1||SHAPE2||SHAPE3 AS SHAPE, "
        szSql &= "  A_TEMP, A_TIME, A_VDD, A_VCC, A_VPP, BOARD_NO, A_MATRIX, "
        szSql &= "  B_TEMP, B_VDD,  B_VPP, B_MATRIX, "
        szSql &= "  E_TEMP, E_VDD,  E_VPP, E_MATRIX, "
        szSql &= "  R_TEMP, R_VDD,  R_VPP, R_MATRIX "
        szSql &= "  "
        For i = 1 To 23
            szSql &= ",FLOW" & i.ToString & " "
        Next
        szSql &= "FROM ( "
        szSql &= "  SELECT KLOTNO AS LOT_NO,"
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='顧客名' THEN KOMOKUDATA ELSE '' END),'') AS CUSTOMER_NM, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='品名' THEN KOMOKUDATA ELSE '' END),'') AS KIND_NM, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='PB-LAYOUT図1' AND KOTEI='組立' THEN KOMOKUDATA ELSE '' END),'') AS PB_LAYOUT, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形1' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE1,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形2' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE2,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形3' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE3,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='エージング温度' THEN KOMOKUDATA ELSE '' END),'') AS A_TEMP, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='エージング時間' THEN KOMOKUDATA ELSE '' END),'') AS A_TIME, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='エージング電圧VDD' THEN KOMOKUDATA ELSE '' END),'') AS A_VDD, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='エージング電圧VCC' THEN KOMOKUDATA ELSE '' END),'') AS A_VCC, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='エージング電圧VLT' THEN KOMOKUDATA ELSE '' END),'') AS A_VPP, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='エージング：ボードNo' THEN KOMOKUDATA ELSE '' END),'') AS BOARD_NO, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='エージング：マトリクスカード' THEN KOMOKUDATA ELSE '' END),'') AS A_MATRIX, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='BIST温度' THEN KOMOKUDATA ELSE '' END),'') AS B_TEMP, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='ＢＩＳＴ電圧VDD' THEN KOMOKUDATA ELSE '' END),'') AS B_VDD, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='ＢＩＳＴ電圧VPP' THEN KOMOKUDATA ELSE '' END),'') AS B_VPP, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='ＢＩＳＴ：マトリクスカード' THEN KOMOKUDATA ELSE '' END),'') AS B_MATRIX, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='E 温度' THEN KOMOKUDATA ELSE '' END),'') AS E_TEMP, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='E 電圧VDD' THEN KOMOKUDATA ELSE '' END),'') AS E_VDD, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='E 電圧VCC' THEN KOMOKUDATA ELSE '' END),'') AS E_VPP, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='E マトリクスカード' THEN KOMOKUDATA ELSE '' END),'') AS E_MATRIX, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='Eﾘﾍﾟｱ温度' THEN KOMOKUDATA ELSE '' END),'') AS R_TEMP, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='Eﾘﾍﾟｱ電圧VDD' THEN KOMOKUDATA ELSE '' END),'') AS R_VDD, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='Eﾘﾍﾟｱ電圧VCC' THEN KOMOKUDATA ELSE '' END),'') AS R_VPP, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='Eﾘﾍﾟｱマトリクスカード' THEN KOMOKUDATA ELSE '' END),'') AS R_MATRIX, "
        For i = 1 To 22
            szSql &= String.Format("    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='選別作業ﾌﾛｰ{0}' THEN KOMOKUDATA ELSE '' END),'') AS FLOW{0}, ", i)
        Next
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='選別作業ﾌﾛｰ23' THEN KOMOKUDATA ELSE '' END),'') AS FLOW23 "
        szSql &= "  FROM PER.L_JYOKENDATA "
        szSql &= "  WHERE KLOTNO = '" & szLotNo & "' "
        szSql &= "  GROUP BY KLOTNO "
        szSql &= ") AS T"

        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1, szLotNo)
        If IsNothing(dt) Then
            GetBiData = New DataTable
        Else
            GetBiData = dt
        End If
    End Function

    Public Function GetBistBakeData(ByVal szLotNo As String) As DataTable
        Dim szSql As String = ""
        szSql &= "SELECT CUSTOMER_NM, KIND_NM, PB_LAYOUT, SHAPE1||SHAPE2||SHAPE3 AS SHAPE, "
        szSql &= "  D_BAKE "
        szSql &= "FROM ( "
        szSql &= "  SELECT KLOTNO AS LOT_NO,"
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='顧客名' THEN KOMOKUDATA ELSE '' END),'') AS CUSTOMER_NM, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='品名' THEN KOMOKUDATA ELSE '' END),'') AS KIND_NM, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='PB-LAYOUT図1' AND KOTEI='組立' THEN KOMOKUDATA ELSE '' END),'') AS PB_LAYOUT, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形1' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE1,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形2' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE2,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形3' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE3,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='Dベーク条件' THEN KOMOKUDATA ELSE '' END),'') AS D_BAKE "
        szSql &= "  FROM PER.L_JYOKENDATA "
        szSql &= "  WHERE KLOTNO = '" & szLotNo & "' "
        szSql &= "  GROUP BY KLOTNO "
        szSql &= ") AS T"

        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1, szLotNo)
        If IsNothing(dt) Then
            GetBistBakeData = New DataTable
        Else
            GetBistBakeData = dt
        End If
    End Function

    Public Function GetBakeData(ByVal szLotNo As String) As DataTable
        Dim szSql As String = ""
        szSql &= "SELECT CUSTOMER_NM, KIND_NM, PB_LAYOUT, SHAPE1||SHAPE2||SHAPE3 AS SHAPE, "
        szSql &= "  TEMP, TIME, VDD, VCC, TO_CHAR(TO_NUMBER(VPP, 99.99)*2, 9.9) AS VPP, BOARD_NO, MATRIX, EQUIP_NO "
        szSql &= "FROM ( "
        szSql &= "  SELECT KLOTNO AS LOT_NO,"
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='顧客名' THEN KOMOKUDATA ELSE '' END),'') AS CUSTOMER_NM, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='品名' THEN KOMOKUDATA ELSE '' END),'') AS KIND_NM, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='PB-LAYOUT図1' AND KOTEI='組立' THEN KOMOKUDATA ELSE '' END),'') AS PB_LAYOUT, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形1' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE1,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形2' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE2,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形3' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE3,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='メッキ仕様' THEN KOMOKUDATA ELSE '' END),'') AS PLATE, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='温度サイクル' THEN KOMOKUDATA ELSE '' END),'') AS TEMP_CYCLE "
        szSql &= "  FROM PER.L_JYOKENDATA "
        szSql &= "  WHERE KLOTNO = '" & szLotNo & "' "
        szSql &= "  GROUP BY KLOTNO "
        szSql &= ") AS T"

        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1, szLotNo)
        If IsNothing(dt) Then
            GetBakeData = New DataTable
        Else
            GetBakeData = dt
        End If
    End Function

    Public Function GetFttData(ByVal szLotNo As String) As DataTable
        Dim szSql As String = ""
        szSql &= "SELECT CUSTOMER_NM, KIND_NM, PB_LAYOUT, SHAPE1||SHAPE2||SHAPE3 AS SHAPE, "
        szSql &= "  A_TEMP, FAIL_RP, LIMIT_TIME, G_TEMP, H_TEMP, H_F_RP, J_TEMP,  J_F_RP "
        szSql &= "FROM ( "
        szSql &= "  SELECT KLOTNO AS LOT_NO,"
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='顧客名' THEN KOMOKUDATA ELSE '' END),'') AS CUSTOMER_NM, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='品名' THEN KOMOKUDATA ELSE '' END),'') AS KIND_NM, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='PB-LAYOUT図1' AND KOTEI='組立' THEN KOMOKUDATA ELSE '' END),'') AS PB_LAYOUT, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形1' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE1,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形2' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE2,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形3' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE3,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='A 試験温度' THEN KOMOKUDATA ELSE '' END),'') AS A_TEMP, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='A 不良率管理値' THEN KOMOKUDATA ELSE '' END),'') AS FAIL_RP, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='リミットタイム' AND KOTEI='選別' THEN KOMOKUDATA ELSE '' END),'') AS LIMIT_TIME, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='G DC+FT温度' THEN KOMOKUDATA ELSE '' END),'') AS G_TEMP, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='G 不良率管理値' THEN KOMOKUDATA ELSE '' END),'') AS G_F_RP, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='H DC+FT温度' THEN KOMOKUDATA ELSE '' END),'') AS H_TEMP, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='H 不良率管理値' THEN KOMOKUDATA ELSE '' END),'') AS H_F_RP, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='J DC+FT温度' THEN KOMOKUDATA ELSE '' END),'') AS J_TEMP, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='J 不良率管理値' THEN KOMOKUDATA ELSE '' END),'') AS J_F_RP "
        szSql &= "  FROM PER.L_JYOKENDATA "
        szSql &= "  WHERE KLOTNO = '" & szLotNo & "' "
        szSql &= "  GROUP BY KLOTNO "
        szSql &= ") AS T"

        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1, szLotNo)
        If IsNothing(dt) Then
            GetFttData = New DataTable
        Else
            GetFttData = dt
        End If
    End Function

    Public Function GetMarkData(ByVal szLotNo As String) As DataTable
        Dim szSql As String = ""
        szSql &= "SELECT CUSTOMER_NM, KIND_NM, PB_LAYOUT, SHAPE1||SHAPE2||SHAPE3 AS SHAPE, "
        szSql &= "  MARK_NM, WEEK_CD, LOT_NO, MARK_NO, MARK_NO_1, MARK_NO_2, MEMO1, MEMO2 "
        szSql &= "FROM ( "
        szSql &= "  SELECT KLOTNO AS LOT_NO,"
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='顧客名' THEN KOMOKUDATA ELSE '' END),'') AS CUSTOMER_NM, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='品名' THEN KOMOKUDATA ELSE '' END),'') AS KIND_NM, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='PB-LAYOUT図1' AND KOTEI='組立' THEN KOMOKUDATA ELSE '' END),'') AS PB_LAYOUT, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形1' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE1,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形2' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE2,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形3' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE3,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='マーク型名 ' THEN KOMOKUDATA ELSE '' END),'') AS MARK_NM, " 'null
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='週コード' THEN KOMOKUDATA ELSE '' END),'') AS WEEK_CD, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='マーク図№' THEN KOMOKUDATA ELSE '' END),'') AS MARK_NO, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='指定マークロットＮｏ１' THEN KOMOKUDATA ELSE '' END),'') AS MARK_NO_1, " 'null
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='指定マークロットＮｏ２' THEN KOMOKUDATA ELSE '' END),'') AS MARK_NO_2, " 'null
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='マーク・メッキ・成形備考上段' THEN KOMOKUDATA ELSE '' END),'') AS MEMO1, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='マーク・メッキ・成形備考下段' THEN KOMOKUDATA ELSE '' END),'') AS MEMO2 "
        szSql &= "  FROM PER.L_JYOKENDATA "
        szSql &= "  WHERE KLOTNO = '" & szLotNo & "' "
        szSql &= "  GROUP BY KLOTNO "
        szSql &= ") AS T"

        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1, szLotNo)
        If IsNothing(dt) Then
            GetMarkData = New DataTable
        Else
            GetMarkData = dt
        End If
    End Function

    Public Function GetPKGDicData(ByVal szLotNo As String) As DataTable
        Dim szSql As String = ""
        szSql &= "SELECT CUSTOMER_NM, KIND_NM, PB_LAYOUT, SHAPE1||SHAPE2||SHAPE3 AS SHAPE, "
        szSql &= "  FRM_MAT, SPEC1||SPEC2||SPEC3 AS SPECS, SPEC_1||SPEC_2 AS SPEC_S, THICK, TRAY, '' AS BLADE "
        szSql &= "FROM ( "
        szSql &= "  SELECT KLOTNO AS LOT_NO,"
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='顧客名' THEN KOMOKUDATA ELSE '' END),'') AS CUSTOMER_NM, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='品名' THEN KOMOKUDATA ELSE '' END),'') AS KIND_NM, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='PB-LAYOUT図1' AND KOTEI='組立' THEN KOMOKUDATA ELSE '' END),'') AS PB_LAYOUT, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形1' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE1,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形2' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE2,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形3' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE3,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='フレーム材質' THEN KOMOKUDATA ELSE '' END),'') AS FRM_MAT, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='成形仕様上段1' THEN KOMOKUDATA ELSE '' END),'') AS SPEC1, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='成形仕様上段2' THEN KOMOKUDATA ELSE '' END),'') AS SPEC2, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='成形仕様上段3' THEN KOMOKUDATA ELSE '' END),'') AS SPEC3, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='成形仕様中段2' THEN KOMOKUDATA ELSE '' END),'') AS SPEC_1, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='成形仕様中段3' THEN KOMOKUDATA ELSE '' END),'') AS SPEC_2, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='成形仕様下段' THEN KOMOKUDATA ELSE '' END),'') AS THICK, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='工程内ﾄﾚｲ' THEN KOMOKUDATA ELSE '' END),'') AS TRAY "
        'szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='ブレード' THEN KOMOKUDATA ELSE '' END),'') AS BLADE " 'null
        szSql &= "  FROM PER.L_JYOKENDATA "
        szSql &= "  WHERE KLOTNO = '" & szLotNo & "' "
        szSql &= "  GROUP BY KLOTNO "
        szSql &= ") AS T"

        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1, szLotNo)
        If IsNothing(dt) Then
            GetPKGDicData = New DataTable
        Else
            GetPKGDicData = dt
        End If
    End Function

    Public Function GetTest0Data(ByVal szLotNo As String) As DataTable
        Dim i As Integer
        Dim szSql As String = ""
        szSql &= "SELECT CUSTOMER_NM, KIND_NM, PB_LAYOUT, SHAPE1||SHAPE2||SHAPE3 AS SHAPE, "
        szSql &= "  TEMP, FAIL_RATE "
        szSql &= "  "
        For i = 1 To 23
            szSql &= ",FLOW" & i.ToString & " "
        Next
        szSql &= "FROM ( "
        szSql &= "  SELECT KLOTNO AS LOT_NO,"
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='顧客名' THEN KOMOKUDATA ELSE '' END),'') AS CUSTOMER_NM, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='品名' THEN KOMOKUDATA ELSE '' END),'') AS KIND_NM, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='PB-LAYOUT図1' AND KOTEI='組立' THEN KOMOKUDATA ELSE '' END),'') AS PB_LAYOUT, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形1' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE1,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形2' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE2,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形3' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE3,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='A 試験温度' THEN KOMOKUDATA ELSE '' END),'') AS TEMP, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='A 不良率管理値' THEN KOMOKUDATA ELSE '' END),'') AS FAIL_RATE, "
        For i = 1 To 22
            szSql &= String.Format("    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='選別作業ﾌﾛｰ{0}' THEN KOMOKUDATA ELSE '' END),'') AS FLOW{0}, ", i)
        Next
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='選別作業ﾌﾛｰ23' THEN KOMOKUDATA ELSE '' END),'') AS FLOW23 "
        szSql &= "  FROM PER.L_JYOKENDATA "
        szSql &= "  WHERE KLOTNO = '" & szLotNo & "' "
        szSql &= "  GROUP BY KLOTNO "
        szSql &= ") AS T"

        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1, szLotNo)
        If IsNothing(dt) Then
            GetTest0Data = New DataTable
        Else
            GetTest0Data = dt
        End If
    End Function

    Public Function GetTest1Data(ByVal szLotNo As String) As DataTable
        Dim i As Integer
        Dim szSql As String = ""
        szSql &= "SELECT CUSTOMER_NM, KIND_NM, PB_LAYOUT, SHAPE1||SHAPE2||SHAPE3 AS SHAPE, "
        szSql &= "  TEMP, FAIL_RATE "
        szSql &= "  "
        For i = 1 To 23
            szSql &= ",FLOW" & i.ToString & " "
        Next
        szSql &= "FROM ( "
        szSql &= "  SELECT KLOTNO AS LOT_NO,"
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='顧客名' THEN KOMOKUDATA ELSE '' END),'') AS CUSTOMER_NM, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='品名' THEN KOMOKUDATA ELSE '' END),'') AS KIND_NM, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='PB-LAYOUT図1' AND KOTEI='組立' THEN KOMOKUDATA ELSE '' END),'') AS PB_LAYOUT, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形1' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE1,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形2' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE2,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形3' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE3,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='G DC+FT温度' THEN KOMOKUDATA ELSE '' END),'') AS TEMP, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='G 不良率管理値' THEN KOMOKUDATA ELSE '' END),'') AS FAIL_RATE, "
        For i = 1 To 22
            szSql &= String.Format("    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='選別作業ﾌﾛｰ{0}' THEN KOMOKUDATA ELSE '' END),'') AS FLOW{0}, ", i)
        Next
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='選別作業ﾌﾛｰ23' THEN KOMOKUDATA ELSE '' END),'') AS FLOW23 "
        szSql &= "  FROM PER.L_JYOKENDATA "
        szSql &= "  WHERE KLOTNO = '" & szLotNo & "' "
        szSql &= "  GROUP BY KLOTNO "
        szSql &= ") AS T"

        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1, szLotNo)
        If IsNothing(dt) Then
            GetTest1Data = New DataTable
        Else
            GetTest1Data = dt
        End If
    End Function

    Public Function GetTest2Data(ByVal szLotNo As String) As DataTable
        Dim i As Integer
        Dim szSql As String = ""
        szSql &= "SELECT CUSTOMER_NM, KIND_NM, PB_LAYOUT, SHAPE1||SHAPE2||SHAPE3 AS SHAPE, "
        szSql &= "  TEMP, FAIL_RATE "
        szSql &= "  "
        For i = 1 To 23
            szSql &= ",FLOW" & i.ToString & " "
        Next
        szSql &= "FROM ( "
        szSql &= "  SELECT KLOTNO AS LOT_NO,"
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='顧客名' THEN KOMOKUDATA ELSE '' END),'') AS CUSTOMER_NM, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='品名' THEN KOMOKUDATA ELSE '' END),'') AS KIND_NM, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='PB-LAYOUT図1' AND KOTEI='組立' THEN KOMOKUDATA ELSE '' END),'') AS PB_LAYOUT, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形1' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE1,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形2' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE2,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形3' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE3,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='H DC+FT温度' THEN KOMOKUDATA ELSE '' END),'') AS TEMP, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='H 不良率管理値' THEN KOMOKUDATA ELSE '' END),'') AS FAIL_RATE, "
        For i = 1 To 22
            szSql &= String.Format("    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='選別作業ﾌﾛｰ{0}' THEN KOMOKUDATA ELSE '' END),'') AS FLOW{0}, ", i)
        Next
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='選別作業ﾌﾛｰ23' THEN KOMOKUDATA ELSE '' END),'') AS FLOW23 "
        szSql &= "  FROM PER.L_JYOKENDATA "
        szSql &= "  WHERE KLOTNO = '" & szLotNo & "' "
        szSql &= "  GROUP BY KLOTNO "
        szSql &= ") AS T"

        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1, szLotNo)
        If IsNothing(dt) Then
            GetTest2Data = New DataTable
        Else
            GetTest2Data = dt
        End If
    End Function

    Public Function GetTest3Data(ByVal szLotNo As String) As DataTable
        Dim i As Integer
        Dim szSql As String = ""
        szSql &= "SELECT CUSTOMER_NM, KIND_NM, PB_LAYOUT, SHAPE1||SHAPE2||SHAPE3 AS SHAPE, "
        szSql &= "  TEMP, FAIL_RATE "
        szSql &= "  "
        For i = 1 To 23
            szSql &= ",FLOW" & i.ToString & " "
        Next
        szSql &= "FROM ( "
        szSql &= "  SELECT KLOTNO AS LOT_NO,"
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='顧客名' THEN KOMOKUDATA ELSE '' END),'') AS CUSTOMER_NM, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='品名' THEN KOMOKUDATA ELSE '' END),'') AS KIND_NM, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='PB-LAYOUT図1' AND KOTEI='組立' THEN KOMOKUDATA ELSE '' END),'') AS PB_LAYOUT, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形1' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE1,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形2' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE2,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形3' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE3,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='J DC+FT温度' THEN KOMOKUDATA ELSE '' END),'') AS TEMP, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='J 不良率管理値' THEN KOMOKUDATA ELSE '' END),'') AS FAIL_RATE, "
        For i = 1 To 22
            szSql &= String.Format("    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='選別作業ﾌﾛｰ{0}' THEN KOMOKUDATA ELSE '' END),'') AS FLOW{0}, ", i)
        Next
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='選別作業ﾌﾛｰ23' THEN KOMOKUDATA ELSE '' END),'') AS FLOW23 "
        szSql &= "  FROM PER.L_JYOKENDATA "
        szSql &= "  WHERE KLOTNO = '" & szLotNo & "' "
        szSql &= "  GROUP BY KLOTNO "
        szSql &= ") AS T"

        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1, szLotNo)
        If IsNothing(dt) Then
            GetTest3Data = New DataTable
        Else
            GetTest3Data = dt
        End If
    End Function

    Public Function GetInOutData(ByVal szLotNo As String) As DataTable
        Dim i As Integer
        Dim szSql As String = ""
        szSql &= "SELECT CUSTOMER_NM, KIND_NM, PB_LAYOUT, SHAPE1||SHAPE2||SHAPE3 AS SHAPE, "
        szSql &= "  A_TEMP, A_TIME, A_VDD, A_VCC, A_VPP, BOARD_NO, A_MATRIX, "
        'szSql &= "  B_TEMP, B_VDD,  B_VPP, B_MATRIX, "
        'szSql &= "  D_BAKE, "
        szSql &= "  E_TEMP, '' AS E_TIME, E_VDD,  E_VCC, E_VPP, E_MATRIX "
        szSql &= "  "
        For i = 1 To 23
            szSql &= ",FLOW" & i.ToString & " "
        Next
        szSql &= "FROM ( "
        szSql &= "  SELECT KLOTNO AS LOT_NO,"
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='顧客名' THEN KOMOKUDATA ELSE '' END),'') AS CUSTOMER_NM, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='品名' THEN KOMOKUDATA ELSE '' END),'') AS KIND_NM, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='PB-LAYOUT図1' AND KOTEI='組立' THEN KOMOKUDATA ELSE '' END),'') AS PB_LAYOUT, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形1' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE1,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形2' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE2,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形3' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE3,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='エージング温度' THEN KOMOKUDATA ELSE '' END),'') AS A_TEMP, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='エージング時間' THEN KOMOKUDATA ELSE '' END),'') AS A_TIME, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='エージング電圧VDD' THEN KOMOKUDATA ELSE '' END),'') AS A_VDD, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='エージング電圧VCC' THEN KOMOKUDATA ELSE '' END),'') AS A_VCC, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='エージング電圧VLT' THEN KOMOKUDATA ELSE '' END),'') AS A_VPP, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='エージング：ボードNo' THEN KOMOKUDATA ELSE '' END),'') AS BOARD_NO, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='エージング：マトリクスカード' THEN KOMOKUDATA ELSE '' END),'') AS A_MATRIX, "
        'szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='BIST温度' THEN KOMOKUDATA ELSE '' END),'') AS B_TEMP, "
        'szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='ＢＩＳＴ電圧VDD' THEN KOMOKUDATA ELSE '' END),'') AS B_VDD, "
        'szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='ＢＩＳＴ電圧VPP' THEN KOMOKUDATA ELSE '' END),'') AS B_VPP, "
        'szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='ＢＩＳＴ：マトリクスカード' THEN KOMOKUDATA ELSE '' END),'') AS B_MATRIX, "
        'szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='Dベーク条件' THEN KOMOKUDATA ELSE '' END),'') AS D_BAKE, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='E 温度' THEN KOMOKUDATA ELSE '' END),'') AS E_TEMP, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='E 電圧VDD' THEN KOMOKUDATA ELSE '' END),'') AS E_VDD, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='E 電圧VCC' THEN KOMOKUDATA ELSE '' END),'') AS E_VCC, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='E 電圧VPP' THEN KOMOKUDATA ELSE '' END),'') AS E_VPP, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='E マトリクスカード' THEN KOMOKUDATA ELSE '' END),'') AS E_MATRIX, "
        For i = 1 To 22
            szSql &= String.Format("    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='選別作業ﾌﾛｰ{0}' THEN KOMOKUDATA ELSE '' END),'') AS FLOW{0}, ", i)
        Next
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='選別作業ﾌﾛｰ23' THEN KOMOKUDATA ELSE '' END),'') AS FLOW23 "
        szSql &= "  FROM PER.L_JYOKENDATA "
        szSql &= "  WHERE KLOTNO = '" & szLotNo & "' "
        szSql &= "  GROUP BY KLOTNO "
        szSql &= ") AS T"

        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1, szLotNo)
        If IsNothing(dt) Then
            GetInOutData = New DataTable
        Else
            GetInOutData = dt
        End If
    End Function

    Public Function GetFtgData(ByVal szLotNo As String) As DataTable
        Dim i As Integer
        Dim szSql As String = ""
        szSql &= "SELECT CUSTOMER_NM, KIND_NM, PB_LAYOUT, SHAPE1||SHAPE2||SHAPE3 AS SHAPE, "
        ' 蘇州対応 2017/04/04 T.Yutaro Upd Start
        'szSql &= "  TRAY, STOPPER, BOX, FULL_SHIP, STORAGE, SPECIAL, LABEL, WEEK_CD "
        szSql &= "  TRAY, STOPPER, BOX, FULL_SHIP, STORAGE, SPECIAL, LABEL, WEEK_CD, FAIL_RATE_MANAGE "
        ' 蘇州対応 2017/04/04 T.Yutaro Upd End
        szSql &= "  "
        For i = 1 To 12
            szSql &= ",FLOW" & i.ToString & " "
        Next
        szSql &= "FROM ( "
        szSql &= "  SELECT KLOTNO AS LOT_NO,"
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='顧客名' THEN KOMOKUDATA ELSE '' END),'') AS CUSTOMER_NM, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='品名' THEN KOMOKUDATA ELSE '' END),'') AS KIND_NM, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='PB-LAYOUT図1' AND KOTEI='組立' THEN KOMOKUDATA ELSE '' END),'') AS PB_LAYOUT, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形1' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE1,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形2' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE2,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形3' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE3,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='トレイ･マガジン' THEN KOMOKUDATA ELSE '' END),'') AS TRAY, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='ストッパ' THEN KOMOKUDATA ELSE '' END),'') AS STOPPER, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='内装箱' THEN KOMOKUDATA ELSE '' END),'') AS BOX, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='満数出荷' THEN KOMOKUDATA ELSE '' END),'') AS FULL_SHIP, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='収納方法' THEN KOMOKUDATA ELSE '' END),'') AS STORAGE, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='特仕内容' THEN KOMOKUDATA ELSE '' END),'') AS SPECIAL, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='出荷ラベル' THEN KOMOKUDATA ELSE '' END),'') AS LABEL, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='週コード' THEN KOMOKUDATA ELSE '' END),'') AS WEEK_CD, "
        ' 蘇州対応 2017/04/04 T.Yutaro Add Start
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='不良率管理値' THEN KOMOKUDATA ELSE '' END),'') AS FAIL_RATE_MANAGE, "
        ' 蘇州対応 2017/04/04 T.Yutaro Add End
        For i = 1 To 11
            szSql &= String.Format("    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='外観・梱包作業ﾌﾛｰ{0}' THEN KOMOKUDATA ELSE '' END),'') AS FLOW{0}, ", i)
        Next
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='外観・梱包作業ﾌﾛｰ12' THEN KOMOKUDATA ELSE '' END),'') AS FLOW12 "
        szSql &= "  FROM PER.L_JYOKENDATA "
        szSql &= "  WHERE KLOTNO = '" & szLotNo & "' "
        szSql &= "  GROUP BY KLOTNO "
        szSql &= ") AS T"

        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1, szLotNo)
        If IsNothing(dt) Then
            GetFtgData = New DataTable
        Else
            GetFtgData = dt
        End If
    End Function

    Public Function GetTapingData(ByVal szLotNo As String) As DataTable
        Dim i As Integer
        Dim szSql As String = ""
        szSql &= "SELECT CUSTOMER_NM, KIND_NM, PB_LAYOUT, SHAPE1||SHAPE2||SHAPE3 AS SHAPE, "
        szSql &= "  CUSTOMER, LOT_MERGE, TRAY_MAGZ, STOPPER, BOX, PACKAGE, LABEL, SHIP_NM, SOURCE "
        szSql &= "  "
        For i = 1 To 12
            szSql &= ",FLOW" & i.ToString & " "
        Next
        szSql &= "FROM ( "
        szSql &= "  SELECT KLOTNO AS LOT_NO,"
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='顧客名' THEN KOMOKUDATA ELSE '' END),'') AS CUSTOMER_NM, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='品名' THEN KOMOKUDATA ELSE '' END),'') AS KIND_NM, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='PB-LAYOUT図1' AND KOTEI='組立' THEN KOMOKUDATA ELSE '' END),'') AS PB_LAYOUT, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形1' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE1,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形2' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE2,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形3' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE3,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='顧客名' THEN KOMOKUDATA ELSE '' END),'') AS CUSTOMER, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='トレイ･マガジン' THEN KOMOKUDATA ELSE '' END),'') AS TRAY_MAGZ, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='ストッパ' THEN KOMOKUDATA ELSE '' END),'') AS STOPPER, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='ロット合成規定' THEN KOMOKUDATA ELSE '' END),'') AS LOT_MERGE, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='内装箱' THEN KOMOKUDATA ELSE '' END),'') AS BOX, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='収納方法' THEN KOMOKUDATA ELSE '' END),'') AS PACKAGE, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='出荷ラベル' THEN KOMOKUDATA ELSE '' END),'') AS LABEL, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='出荷型名' THEN KOMOKUDATA ELSE '' END),'') AS SHIP_NM, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='移管元' THEN KOMOKUDATA ELSE '' END),'') AS SOURCE, "
        For i = 1 To 11
            szSql &= String.Format("    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='外観・梱包作業ﾌﾛｰ{0}' THEN KOMOKUDATA ELSE '' END),'') AS FLOW{0}, ", i)
        Next
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='外観・梱包作業ﾌﾛｰ12' THEN KOMOKUDATA ELSE '' END),'') AS FLOW12 "
        szSql &= "  FROM PER.L_JYOKENDATA "
        szSql &= "  WHERE KLOTNO = '" & szLotNo & "' "
        szSql &= "  GROUP BY KLOTNO "
        szSql &= ") AS T"

        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1, szLotNo)
        If IsNothing(dt) Then
            GetTapingData = New DataTable
        Else
            GetTapingData = dt
        End If
    End Function

    Public Function GetPackingData(ByVal szLotNo As String) As DataTable
        Dim i As Integer
        Dim szSql As String = ""
        szSql &= "SELECT CUSTOMER_NM, KIND_NM, PB_LAYOUT, SHAPE1||SHAPE2||SHAPE3 AS SHAPE, "
        szSql &= "  TRAY_MAGZ, STOPPER, BOX, FULL_SHIP, PACKAGE, SPECIAL, LABEL, SHIP_NM, SOURCE "
        szSql &= "  "
        For i = 1 To 12
            szSql &= ",FLOW" & i.ToString & " "
        Next
        szSql &= "FROM ( "
        szSql &= "  SELECT KLOTNO AS LOT_NO,"
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='顧客名' THEN KOMOKUDATA ELSE '' END),'') AS CUSTOMER_NM, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='品名' THEN KOMOKUDATA ELSE '' END),'') AS KIND_NM, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='PB-LAYOUT図1' AND KOTEI='組立' THEN KOMOKUDATA ELSE '' END),'') AS PB_LAYOUT, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形1' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE1,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形2' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE2,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形3' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE3,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='トレイ･マガジン' THEN KOMOKUDATA ELSE '' END),'') AS TRAY_MAGZ, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='ストッパ' THEN KOMOKUDATA ELSE '' END),'') AS STOPPER, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='内装箱' THEN KOMOKUDATA ELSE '' END),'') AS BOX, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='満数出荷' THEN KOMOKUDATA ELSE '' END),'') AS FULL_SHIP, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='収納方法' THEN KOMOKUDATA ELSE '' END),'') AS PACKAGE, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='特仕内容' THEN KOMOKUDATA ELSE '' END),'') AS SPECIAL, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='出荷ラベル' THEN KOMOKUDATA ELSE '' END),'') AS LABEL, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='出荷型名' THEN KOMOKUDATA ELSE '' END),'') AS SHIP_NM, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='移管元' THEN KOMOKUDATA ELSE '' END),'') AS SOURCE, "
        For i = 1 To 11
            szSql &= String.Format("    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='外観・梱包作業ﾌﾛｰ{0}' THEN KOMOKUDATA ELSE '' END),'') AS FLOW{0}, ", i)
        Next
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='外観・梱包作業ﾌﾛｰ12' THEN KOMOKUDATA ELSE '' END),'') AS FLOW12 "
        szSql &= "  FROM PER.L_JYOKENDATA "
        szSql &= "  WHERE KLOTNO = '" & szLotNo & "' "
        szSql &= "  GROUP BY KLOTNO "
        szSql &= ") AS T"

        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1, szLotNo)
        If IsNothing(dt) Then
            GetPackingData = New DataTable
        Else
            GetPackingData = dt
        End If
    End Function

    Public Function GetTEMPData(ByVal szLotNo As String) As DataTable
        Dim szSql As String = ""
        szSql &= "SELECT CUSTOMER_NM, KIND_NM, PB_LAYOUT, SHAPE1||SHAPE2||SHAPE3 AS SHAPE, "
        szSql &= "    TEMP_CYCLE, MEMO1, MEMO2 "
        szSql &= "FROM ( "
        szSql &= "  SELECT KLOTNO AS LOT_NO,"
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='顧客名' THEN KOMOKUDATA ELSE '' END),'') AS CUSTOMER_NM, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='品名' THEN KOMOKUDATA ELSE '' END),'') AS KIND_NM, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='PB-LAYOUT図1' AND KOTEI='組立' THEN KOMOKUDATA ELSE '' END),'') AS PB_LAYOUT, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形1' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE1,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形2' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE2,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形3' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE3,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='温度サイクル' THEN KOMOKUDATA ELSE '' END),'') AS TEMP_CYCLE, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='備考（C）上段' THEN KOMOKUDATA ELSE '' END),'') AS MEMO1, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='備考（C）下段' THEN KOMOKUDATA ELSE '' END),'') AS MEMO2 "
        szSql &= "  FROM PER.L_JYOKENDATA "
        szSql &= "  WHERE KLOTNO = '" & szLotNo & "' "
        szSql &= "  GROUP BY KLOTNO "
        szSql &= ") AS T"

        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1, szLotNo)
        If IsNothing(dt) Then
            GetTEMPData = New DataTable
        Else
            GetTEMPData = dt
        End If
    End Function

    Public Function GetMekiData(ByVal szLotNo As String) As DataTable
        Dim szSql As String = ""
        szSql &= "SELECT CUSTOMER_NM, KIND_NM, PB_LAYOUT, SHAPE1||SHAPE2||SHAPE3 AS SHAPE, "
        szSql &= "  BALL_1, BALL_2, FRM_MAT "
        szSql &= "FROM ( "
        szSql &= "  SELECT KLOTNO AS LOT_NO,"
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='顧客名' THEN KOMOKUDATA ELSE '' END),'') AS CUSTOMER_NM, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='品名' THEN KOMOKUDATA ELSE '' END),'') AS KIND_NM, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='PB-LAYOUT図1' AND KOTEI='組立' THEN KOMOKUDATA ELSE '' END),'') AS PB_LAYOUT, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形1' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE1,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形2' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE2,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形3' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE3,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='メッキ・ボール仕様上段' THEN KOMOKUDATA ELSE '' END),'') AS BALL_1, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='メッキ・ボール仕様下段' THEN KOMOKUDATA ELSE '' END),'') AS BALL_2, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='フレーム材質' THEN KOMOKUDATA ELSE '' END),'') AS FRM_MAT "
        szSql &= "  FROM PER.L_JYOKENDATA "
        szSql &= "  WHERE KLOTNO = '" & szLotNo & "' "
        szSql &= "  GROUP BY KLOTNO "
        szSql &= ") AS T"

        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1, szLotNo)
        If IsNothing(dt) Then
            GetMekiData = New DataTable
        Else
            GetMekiData = dt
        End If

    End Function

    Public Function GetCutMoldData(ByVal szLotNo As String) As DataTable
        Dim szSql As String = ""
        szSql &= "SELECT CUSTOMER_NM, KIND_NM, PB_LAYOUT, SHAPE1||SHAPE2||SHAPE3 AS SHAPE, "
        szSql &= "  BALL_1, BALL_2, FRM_MAT, SPEC1||SPEC2||SPEC3 AS SPECS, SPEC_1||SPEC_2||THICK AS SPEC_S, TRAY "
        szSql &= "FROM ( "
        szSql &= "  SELECT KLOTNO AS LOT_NO,"
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='顧客名' THEN KOMOKUDATA ELSE '' END),'') AS CUSTOMER_NM, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='品名' THEN KOMOKUDATA ELSE '' END),'') AS KIND_NM, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='PB-LAYOUT図1' AND KOTEI='組立' THEN KOMOKUDATA ELSE '' END),'') AS PB_LAYOUT, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形1' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE1,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形2' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE2,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='製品外形3' THEN KOMOKUDATA ELSE '' END),'') AS SHAPE3,  "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='メッキ・ボール仕様上段' THEN KOMOKUDATA ELSE '' END),'') AS BALL_1, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='メッキ・ボール仕様下段' THEN KOMOKUDATA ELSE '' END),'') AS BALL_2, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='フレーム材質' THEN KOMOKUDATA ELSE '' END),'') AS FRM_MAT, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='成形仕様上段1' THEN KOMOKUDATA ELSE '' END),'') AS SPEC1, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='成形仕様上段2' THEN KOMOKUDATA ELSE '' END),'') AS SPEC2, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='成形仕様上段3' THEN KOMOKUDATA ELSE '' END),'') AS SPEC3, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='成形仕様中段2' THEN KOMOKUDATA ELSE '' END),'') AS SPEC_1, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='成形仕様中段3' THEN KOMOKUDATA ELSE '' END),'') AS SPEC_2, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='成形仕様下段' THEN KOMOKUDATA ELSE '' END),'') AS THICK, "
        szSql &= "    ARRAY_TO_STRING(ARRAY_AGG(CASE WHEN KOMOKUNAME='工程内ﾄﾚｲ' THEN KOMOKUDATA ELSE '' END),'') AS TRAY "
        szSql &= "  FROM PER.L_JYOKENDATA "
        szSql &= "  WHERE KLOTNO = '" & szLotNo & "' "
        szSql &= "  GROUP BY KLOTNO "
        szSql &= ") AS T"

        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1, szLotNo)
        If IsNothing(dt) Then
            GetCutMoldData = New DataTable
        Else
            GetCutMoldData = dt
        End If

    End Function

    Public Function GetServerTime() As DateTime
        Dim szSql As String = ""
        szSql &= "SELECT sysdate  from dual" 'UPD MIAO 2018/10/17
        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1)
        If IsNothing(dt) OrElse dt.Rows.Count <= 0 Then
            GetServerTime = DateTime.MinValue
        Else
            GetServerTime = dt.Rows(0)(0)
        End If

    End Function

    Public Function GetCustomerShort(ByVal szLotNo As String) As String
        Dim szSql As String = ""
        szSql &= "SELECT KOMOKUDATA "
        szSql &= "FROM PER.L_JYOKENDATA "
        szSql &= "WHERE KLOTNO = '" & szLotNo & "' "
        szSql &= "AND KOMOKUNAME='CUSTOMER SHORT' "

        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1, szLotNo)
        If IsNothing(dt) Then
            Return String.Empty
        Else
            If dt.Rows.Count > 0 Then
                Return dt.Rows(0)(0).ToString
            Else
                Return String.Empty
            End If
        End If
    End Function

    ' 2017/05/12 蘇州対応 追加
    ' GridViewマスタ取得
    Public Function GetGridViewLot(ByVal koutei_cd As String) As DataTable
        Dim szSql As String = ""
        szSql &= "SELECT KOUTEI_CD, KOUMOKU_NM, MNF_CND_TAG, INPUT_METHOD, KEYPAD, SELECT_WINDOW, DATA_TYPE, MNF_CND_GET_KBN,"
        szSql &= "  BEGIN_ACTIVE_FLG, BEGIN_INPUT_CHK_FLG, BEGIN_MATCH_CHK_FLG, BEGIN_TYPE_CHK_FLG, "
        szSql &= "  COMPLETE_ACTIVE_FLG, COMPLETE_INPUT_CHK_FLG, COMPLETE_MATCH_CHK_FLG, COMPLETE_TYPE_CHK_FLG "
        szSql &= "  FROM PER.T_SF_CLIENT_ITEM "
        szSql &= "  WHERE KOUTEI_CD = '" & koutei_cd & "' "
        szSql &= "  ORDER BY SEQ"

        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1)
        If IsNothing(dt) Then
            GetGridViewLot = New DataTable
        Else
            GetGridViewLot = dt
        End If

    End Function

    ' 製造条件取得（l_jyokendata）
    Public Function GetJyokenData(ByVal LotNo As String, ByVal kotei As String) As DataTable
        Dim szSql As String = ""
        szSql &= "SELECT KOMOKUNAME, KOMOKUDATA ,KOTEI "
        szSql &= "FROM PER.L_JYOKENDATA "
        szSql &= "WHERE KLOTNO = '" & LotNo & "' "
        szSql &= "AND KOTEI IN ( '" & kotei & "', 'LOTINFO' ) "
        'szSql &= "ORDER BY CASE KOTEI WHEN 'LOTINFO' THEN 1 ELSE 2 END "'DEL MIAO 2018/10/17
        szSql &= "ORDER BY CASE WHEN KOTEI = 'LOTINFO' THEN 1 ELSE 2 END " 'ADD MIAO 2018/10/17

        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1, LotNo)
        If IsNothing(dt) Then
            GetJyokenData = New DataTable
        Else
            GetJyokenData = dt
        End If

    End Function
    Public Function getDTCount(ByVal LotNo As String) As String
        Dim szSql As String = ""
        szSql &= " SELECT KOMOKUDATA FROM PER.L_JYOKENDATA "
        szSql &= " WHERE KLOTNO='" & LotNo & "' AND "
        szSql &= " KOMOKUNAME = 'DP CNT' AND "
        szSql &= " KOTEI='A41'"

        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1, LotNo)
        If IsNothing(dt) OrElse dt.Rows.Count = 0 Then
            getDTCount = "0"
        Else
            getDTCount = dt(0)(0)
        End If

    End Function
    Public Function GetJyokenALLData(ByVal LotNo As String) As DataTable
        Dim szSql As String = ""
        szSql &= "SELECT KOMOKUNAME, KOMOKUDATA ,KOTEI "
        szSql &= "FROM PER.L_JYOKENDATA "
        szSql &= "WHERE KLOTNO = '" & LotNo & "' "

        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1, LotNo)
        If IsNothing(dt) Then
            GetJyokenALLData = New DataTable
        Else
            GetJyokenALLData = dt
        End If

    End Function
    ''' <summary>
    ''' 得到Resin 
    ''' </summary>
    ''' <param name="lotNo"></param>
    ''' <returns></returns>
    Public Function GetResin(lotNo As String) As String 'add miaojf 2020/8/12 ver.60
        Dim szSql As String = ""
        Dim rtn As String = ""
        szSql &= " SELECT KOMOKUDATA from PER.L_JYOKENDATA where KLOTNO = '" & lotNo & "' and KOTEI = 'A51' and KOMOKUNAME = 'RESIN'"

        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1, lotNo)
        If IsNothing(dt) OrElse dt.Rows.Count = 0 Then
            rtn = ""
        Else
            rtn = IIf(IsDBNull(dt(0)(0)), "", dt(0)(0))
        End If
        Return rtn
    End Function
    ' 製造条件取得（l_jyokendata）
    Public Function GetProcessInfo(ByVal LotNo As String) As DataTable
        Dim szSql As String = ""
        szSql &= "SELECT A.KOMOKUNAME, A.KOMOKUDATA "
        szSql &= "FROM PER.L_JYOKENDATA AS A "
        szSql &= "INNER JOIN PER.T_PROC_CD AS B "
        szSql &= "ON B.PROC_CD = A.KOMOKUDATA "
        szSql &= "WHERE KLOTNO = '" & LotNo & "' "
        szSql &= "AND KOTEI = 'PROCESS_INFO' "

        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1, LotNo)
        If IsNothing(dt) Then
            GetProcessInfo = New DataTable
        Else
            GetProcessInfo = dt
        End If

    End Function
    ' 2017/05/12 蘇州対応 追加

    '前工程の取得
    Public Function GetPreProcCode(ByVal lotno As String, ByVal procCd As String) As DataTable
        Dim szSql As String = ""
        szSql &= "SELECT * FROM (" 'ADD MIAO 2018/11/05
        szSql &= "SELECT "
        szSql &= "J.KOMOKUDATA AS PREPROC "
        szSql &= ", P.PROC_TABLE AS PROCTABLE "
        szSql &= "FROM PER.L_JYOKENDATA J "
        szSql &= "INNER JOIN PER.T_PROC_CD P "
        szSql &= "ON J.KLOTNO = '" & lotno & "' "
        szSql &= "AND J.KOTEI = 'PROCESS_INFO' "
        szSql &= "AND J.KOMOKUDATA = P.PROC_CD "
        szSql &= "AND P.SF_MANAGED = '1' "
        szSql &= "WHERE "
        szSql &= "TO_NUMBER(KOMOKUNAME, '99') < ( "
        szSql &= "SELECT "
        szSql &= "TO_NUMBER(KOMOKUNAME, '99')  "
        szSql &= "FROM PER.L_JYOKENDATA M "
        szSql &= "WHERE M.KLOTNO = '" & lotno & "' "
        szSql &= "AND M.KOTEI = 'PROCESS_INFO' "
        szSql &= "AND M.KOMOKUDATA = '" & procCd & "' ) "
        'szSql &= "AND ROWNUM <= 1 " 'ADD MIAO 2018/10/17'DEL MIAO 2018/11/05
        szSql &= "ORDER BY "
        szSql &= "TO_NUMBER(KOMOKUNAME, '99') DESC "
        'szSql &= "LIMIT 1;" 'DEL MIAO 2018/10/17
        szSql &= ") WHERE ROWNUM <= 1" 'ADD MIAO 2018/11/05

        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1, lotno)
        If IsNothing(dt) Then
            GetPreProcCode = New DataTable
        Else
            GetPreProcCode = dt
        End If
    End Function

    '次工程の取得
    Public Function GetNextProcCode(ByVal lotno As String, ByVal procCd As String) As DataTable
        Dim szSql As String = ""
        szSql &= "SELECT * FROM (" 'ADD MIAO 2018/11/05

        szSql &= "Select "
        szSql &= "J.KOMOKUDATA As POSTPROC "
        szSql &= ", P.PROC_TABLE As PROCTABLE "
        szSql &= "FROM PER.L_JYOKENDATA J "
        szSql &= "INNER JOIN PER.T_PROC_CD P "
        szSql &= "On J.KLOTNO = '" & lotno & "' "
        szSql &= "AND J.KOTEI = 'PROCESS_INFO' "
        szSql &= "AND J.KOMOKUDATA = P.PROC_CD "
        szSql &= "AND P.SF_MANAGED = '1' "
        szSql &= "WHERE "
        szSql &= "TO_NUMBER(KOMOKUNAME, '99') >= ( "
        szSql &= "SELECT "
        szSql &= "TO_NUMBER(KOMOKUNAME, '99')  "
        szSql &= "FROM PER.L_JYOKENDATA M "
        szSql &= "WHERE M.KLOTNO = '" & lotno & "' "
        szSql &= "AND M.KOTEI = 'PROCESS_INFO' "
        szSql &= "AND M.KOMOKUDATA = '" & procCd & "' ) "
        'szSql &= "AND ROWNUM <= 1 " 'ADD MIAO 2018/10/17
        szSql &= "ORDER BY "
        szSql &= "TO_NUMBER(KOMOKUNAME, '99') ASC "
        'szSql &= "LIMIT 1;"'DEL MIAO 2018/10/17
        szSql &= ") WHERE ROWNUM <= 1" 'ADD MIAO 2018/11/05

        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1, lotno)
        If IsNothing(dt) Then
            GetNextProcCode = New DataTable
        Else
            GetNextProcCode = dt
        End If
    End Function
    Public Function GetDefExec(ByVal procCd As String, ByVal execPgTag As String) As DataTable
        Dim szSql As String = ""

        szSql &= "SELECT "
        szSql &= " PROC_CD, EXEC_PG_TAG, COMMAND_LINE, COMMAND_OPTION, DESCRIPTION "
        szSql &= "FROM "
        szSql &= "  PER.T_DEF_EXEC "
        szSql &= "WHERE "
        szSql &= " PROC_CD = '" & procCd & "' "
        szSql &= " AND EXEC_PG_TAG = '" & execPgTag & "' "
        szSql &= "ORDER BY "
        szSql &= " PROC_CD, EXEC_PG_TAG;"

        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1)
        If IsNothing(dt) Then
            GetDefExec = New DataTable
        Else
            GetDefExec = dt
        End If
    End Function


    '前工程の情報取得(工程名、テーブル名、SF管理フラグ)
    Public Function GetPreProc(ByVal lotno As String, ByVal procCd As String) As DataTable
        Dim szSql As String = ""
        szSql &= "SELECT * FROM (" 'ADD MIAO 2018/11/2
        szSql &= "SELECT "
        szSql &= "J.KOMOKUDATA AS PREPROC "
        szSql &= ", P.PROC_TABLE AS PROCTABLE "
        szSql &= ", P.SF_MANAGED as SF_MANAGED "
        szSql &= "FROM PER.L_JYOKENDATA J "
        szSql &= "INNER JOIN PER.T_PROC_CD P "
        szSql &= "ON J.KLOTNO = '" & lotno & "' "
        szSql &= "AND J.KOTEI = 'PROCESS_INFO' "
        szSql &= "AND J.KOMOKUDATA = P.PROC_CD "
        szSql &= "AND P.SF_MANAGED = '1' "
        szSql &= "WHERE "
        szSql &= "TO_NUMBER(KOMOKUNAME, '99') < ( "
        szSql &= "SELECT "
        szSql &= "TO_NUMBER(KOMOKUNAME, '99')  "
        szSql &= "FROM PER.L_JYOKENDATA M "
        szSql &= "WHERE M.KLOTNO = '" & lotno & "' "
        szSql &= "AND M.KOTEI = 'PROCESS_INFO' "
        szSql &= "AND M.KOMOKUDATA = '" & procCd & "' ) "
        'szSql &= "AND ROWNUM <= 1 " 'ADD MIAO 2018/10/17
        szSql &= "ORDER BY "
        szSql &= "TO_NUMBER(KOMOKUNAME, '99') DESC "
        szSql &= ") WHERE ROWNUM <= 1 " 'ADD MIAO 2018/11/2
        'szSql &= "LIMIT 1;"'DEL MIAO 2018/10/17

        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1, lotno)
        If IsNothing(dt) Then
            GetPreProc = New DataTable
        Else
            GetPreProc = dt
        End If
    End Function

End Class
